package com.biz.primus.ms.promotion.dao.po;

import com.biz.primus.base.vo.member.MemberInfoVo;
import com.biz.primus.model.promotion.vo.OrderPromotionDetailVo;
import com.biz.primus.model.promotion.vo.req.OrderPromotionReqDetailVo;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import lombok.Getter;
import lombok.Setter;

/**
 * 秒杀活动促销
 *
 * @author david-liu
 */
@Entity
@Getter
@Setter
public class SeckillPromotion extends BasePromotion {
    private static final long serialVersionUID = 3506834895211367803L;

    @OneToMany(mappedBy = "seckillPromotion")
    private List<SeckillProduct> seckillProducts;

    /**
     * 秒杀活动日
     */
    private LocalDate promotionDate;

    /**
     * 秒杀活动开始时间点
     */
    private LocalTime startTimePoint;

    /**
     * 秒杀活动结束时间点
     */
    private LocalTime endTimePoint;

    @Override
    public boolean isMatchPromotionRule(OrderPromotionReqDetailVo detailVo) {
        return false;
    }

    public boolean isMatchPromotionRule(MemberInfoVo memberInfo) {
        return this.isMemberInPromotionScope(memberInfo) && isNowInPromotionEffectPeriod();
    }

    @Override
    public OrderPromotionDetailVo getOrderPromotionDetail(OrderPromotionReqDetailVo reqDetailVo) {
        return null;
    }
}
